from fastapi import APIRouter, Depends
from typing import List
from ..services.movie_service import MovieService
from ..schemas.analytics import RatingDistribution, GenreDistribution
from ..dependencies import get_movie_service
from ..core.config import settings

router = APIRouter(
    prefix=f"{settings.API_V1_STR}/analytics",
    tags=["analytics"]
)

@router.get("/ratings", response_model=List[RatingDistribution])
async def get_rating_distribution(
    movie_service: MovieService = Depends(get_movie_service)
):
    """获取电影评分分布"""
    return movie_service.get_rating_distribution()

@router.get("/genres", response_model=List[GenreDistribution])
async def get_genre_distribution(
    movie_service: MovieService = Depends(get_movie_service)
):
    """获取电影类型流行度"""
    return movie_service.get_genre_distribution() 